package com.openbravo.pos.reports;

import com.openbravo.basic.BasicException;
import com.openbravo.data.loader.BaseSentence;
import com.openbravo.data.loader.Datas;
import com.openbravo.data.loader.QBFBuilder;
import com.openbravo.data.loader.SerializerReadBasic;
import com.openbravo.data.loader.StaticSentence;
import com.openbravo.data.user.EditorCreator;
import com.openbravo.pos.forms.AppLocal;
import com.openbravo.pos.forms.AppView;
import com.openbravo.pos.forms.BeanFactoryException;
import java.util.ArrayList;
import java.util.List;

public class PanelReportBean extends JPanelReport
{
  private String title;
  private String report;
  private String resourcebundle = null;
  private String sentence;
  private List<Datas> fielddatas = new ArrayList();
  private List<String> fieldnames = new ArrayList();
  private List<String> paramnames = new ArrayList();
  private JParamsComposed qbffilter = new JParamsComposed();

  public void init(AppView paramAppView)
    throws BeanFactoryException
  {
    this.qbffilter.init(paramAppView);
    super.init(paramAppView);
  }

  public void activate()
    throws BasicException
  {
    this.qbffilter.activate();
    super.activate();
    if (this.qbffilter.isEmpty())
    {
      setVisibleFilter(false);
      setVisibleButtonFilter(false);
    }
  }

  protected EditorCreator getEditorCreator()
  {
    return this.qbffilter;
  }

  public void setTitle(String paramString)
  {
    this.title = paramString;
  }

  public void setTitleKey(String paramString)
  {
    this.title = AppLocal.getIntString(paramString);
  }

  public String getTitle()
  {
    return this.title;
  }

  public void setReport(String paramString)
  {
    this.report = paramString;
  }

  protected String getReport()
  {
    return this.report;
  }

  public void setResourceBundle(String paramString)
  {
    this.resourcebundle = paramString;
  }

  protected String getResourceBundle()
  {
    return this.resourcebundle == null ? this.report : this.resourcebundle;
  }

  public void setSentence(String paramString)
  {
    this.sentence = paramString;
  }

  public void addField(String paramString, Datas paramDatas)
  {
    this.fieldnames.add(paramString);
    this.fielddatas.add(paramDatas);
  }

  public void addParameter(String paramString)
  {
    this.paramnames.add(paramString);
  }

  protected BaseSentence getSentence()
  {
    return new StaticSentence(this.m_App.getSession(), new QBFBuilder(this.sentence, (String[])this.paramnames.toArray(new String[this.paramnames.size()])), this.qbffilter.getSerializerWrite(), new SerializerReadBasic((Datas[])this.fielddatas.toArray(new Datas[this.fielddatas.size()])));
  }

  protected ReportFields getReportFields()
  {
    return new ReportFieldsArray((String[])this.fieldnames.toArray(new String[this.fieldnames.size()]));
  }

  public void addQBFFilter(ReportEditorCreator paramReportEditorCreator)
  {
    this.qbffilter.addEditor(paramReportEditorCreator);
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.reports.PanelReportBean
 * JD-Core Version:    0.6.0
 */